package com.qezhhnjy.firstuser.bean;

import com.qezhhnjy.demo.starter.service.DemoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author zhaoyangfu
 * @date 2021/5/18-19:29
 */
@Component
@Slf4j
public class MyBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        // TODO Auto-generated method stub
        if (bean.getClass().getName().contains("com.qezhhnjy"))
            log.warn("postProcessBeforeInitialization..." + beanName + "=>" + bean);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        // TODO Auto-generated method stub
        if (bean.getClass().getName().contains("com.qezhhnjy"))
            log.warn("postProcessAfterInitialization..." + beanName + "=>" + bean);
        return bean;
    }

}
